package com.dongyimai.oauth.interceptor;

import com.dongyimai.oauth.token.AdminToken;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TokenRequestInterceptor implements RequestInterceptor {
    /*Feign 执行之前拦截 */
    @Override
    public void apply(RequestTemplate requestTemplate) {
        String adminToken = AdminToken.createAdminToken();
        requestTemplate.header("Authorization", "bearer " + adminToken);
    }
}